﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;
using BindingIEBrowser;

namespace BindingIEBrowserUI
{
    public partial class IEInstancesForm : Form
    {
        private BindingCore _core;
        private IList<IEInstanceItems> _ieInstances; 
        public IEInstancesForm()
        {
            InitializeComponent();
            _core = new BindingCore();
            this.RefreshIEInstance();
        }

        private void button_Refresh_Click(object sender, EventArgs e)
        {
            this.RefreshIEInstance();
        }

        private void RefreshIEInstance()
        {
            _ieInstances = _core.GetIEInstances();
            this.dataGridView1.DataSource = _ieInstances;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
                return;
            if (_core.GetIEInstances(this._ieInstances[e.RowIndex]))
            {
                var hdff = new HtmlDocumentFramesForm(_core.GetHDFrames());
                hdff.Show();

                //IList<HDFormItems> pp = _core.GetHDForms();
            }
        }
    }
}
